package com.bvblogic.android.services;

import com.bvblogic.android.CurentSessionsDataActivity;

import android.util.DisplayMetrics;
import android.view.Display;
import android.app.Activity;

public class DeviceInfo {
	public static String KEY_LDPI = "ldpi";
	public static String KEY_MDPI = "mdpi";
	public static String KEY_HDPI = "hdpi";
	public static String KEY_XHDPI = "xhdpi";
	

	
	private static boolean isInitialized;
	
	public static void getResolution (Activity activity){
		if (isInitialized)
			return;
		
		Display display = activity.getWindowManager().getDefaultDisplay();
		DisplayMetrics displayMetrics = new DisplayMetrics();
		display.getMetrics(displayMetrics);
		
		CurentSessionsDataActivity.device_Width = displayMetrics.heightPixels;
		CurentSessionsDataActivity.device_Height = displayMetrics.widthPixels;
		
//		CurentSessionsDataActivity.deviceDUIN = UUID.randomUUID().toString();
		
//		Log.d("deviceDUIN: ", CurentSessionsDataActivity.deviceDUIN);
//		Log.d("Width Height", "W: "+CurentSessionsDataActivity.device_Width+"  H: "+CurentSessionsDataActivity.device_Height);
		
		int density = displayMetrics.densityDpi;
		switch (density) {
		case DisplayMetrics.DENSITY_LOW:
			CurentSessionsDataActivity.screen_resolution = KEY_LDPI;
			break;
		case DisplayMetrics.DENSITY_MEDIUM:
			CurentSessionsDataActivity.screen_resolution = KEY_MDPI;
			break;			
		case DisplayMetrics.DENSITY_HIGH:
			CurentSessionsDataActivity.screen_resolution = KEY_HDPI;
			break;
		default:
			if (density>=320)
				CurentSessionsDataActivity.screen_resolution = KEY_XHDPI;
			break;
		}
		
		isInitialized = true;
	}

}
